#  -*- coding:utf-8 -*- 
"""
@ author: 罗金盛
@ time: 2024/3/6 
@ file: 13.多线程.py

"""
import threading

def print1(name):
    for i in range(10):
        print(threading.current_thread())  # 打印当前线程

def print2(name):
    for i in range(10):
        print(name)

thread1 = threading.Thread(target=print1,args=('ljs',))
thread2 = threading.Thread(target=print2,args=('yrz',))

# 线程默认都是非守护线程 如果要设置为守护线程 必须在start之前设置
thread1.setDaemon(True)
thread2.setDaemon(True)


thread1.start()
thread2.start()
# 守护线程：线程都是主线程的附庸，你结束我就结束
# 非守护线程：主线程跟我没关系，我要自己执行完成才会结束
thread1.join()
thread2.join()

print('主线程结束了！')